import generate from "./generate.js";
import parseAstToStr from "./parseAstToStr.js";

export default function compileToFunction(templateStr) {
  // 将模板字符串编译为 ast 树结构
  const Ast = parseAstToStr(templateStr);
  // console.log(" Ast======> ", Ast);
  // 从Ast结构生成渲染函数
  const render = generate(Ast);
  return render;
}
